package com.uetoken.cn.adapter;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.uetoken.cn.R;
import com.uetoken.cn.adapter.model.WalletStripModel;
import com.uetoken.cn.manager.UEDataManager;

public class WalletStripAdapter extends BaseQuickAdapter<WalletStripModel, BaseViewHolder> {

    private Context mContext;

    public WalletStripAdapter(Context context) {
        super(R.layout.item_wallet_strip_choose, UEDataManager.getInstance().getWalletStripModelList());
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, WalletStripModel item) {
        helper.setText(R.id.cnvTv, item.getWalletUnit());
        helper.setText(R.id.cnvDetailsTv, String.format(mContext.getResources().getString(R.string.available_balance_txt_2), item.getWalletLimit(), item.getWalletUnit()));
        int backgroundRes;
        if (item.isSelected()) {
            backgroundRes = R.mipmap.icon_on_checked;
        } else {
            backgroundRes = R.mipmap.icon_no_checked;
        }
        helper.setImageResource(R.id.cnvIv, backgroundRes);
    }
}
